﻿using ConfExpert.Forms.Base;
using ConfExpert.Utility;
using DevExpress.XtraEditors.Controls;
using DevTeam;
using System;
using System.Windows.Forms;

namespace ConfExpert.Forms.SatinAlma.YeniYapi
{
    public partial class YeniPO : XForm
    {
        public YeniPO()
        {
            InitializeComponent();
        }

        private void YeniPO_Load(object sender, EventArgs e)
        {
            ShowOnlyFooter();
            gleTalepTipi.Properties.Assign(RI(Rp.TalepTipi));
            gleTalepTipi.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
            gleTalepTipi.EditValue = 1;
        }


        private void btnKaydet_Click(object sender, EventArgs e)
        {
            TAM.POTableAdapter = new Datasets.MyDataTableAdapters.POTableAdapter();
            Datasets.MyData.PORow po = ds.PO.NewPORow();
            po.TalepTipiId = gleTalepTipi.EditValue.ToInt();
            po.Notes = txtNotes.Text;
            po.UserId = WhoAmI;
            po.TalepTarihi = DateTime.Now;
            po.ModifiedOn = DateTime.Now;
            po.MusteriOdemeli = chkMusteriOdemeli.Checked;
            ds.PO.AddPORow(po);
            TAM.POTableAdapter.Update(ds.PO);
            AppSession.MainForm.ShowMdiChildForm(typeof(PO), po.POId);
            this.DialogResult = DialogResult.OK;
        }

        private void YeniPO_Shown(object sender, EventArgs e)
        {
            txtNotes.Focus();
        }

        private void pictureEdit1_EditValueChanged(object sender, EventArgs e)
        {

        }
    }
}
